<template>
    <div class="menu-bar">
        <router-link to="home">
            <span class="icon icon-menus"></span>
            <h4>首页</h4>
        </router-link>
        <router-link to="classify">
            <span class="icon icon-menus"></span>
            <h4>分类</h4>
        </router-link>
        <router-link to="shopcart">
            <span class="icon icon-menus"></span>
            <h4>购物车</h4>
        </router-link>
        <router-link to="user">
            <span class="icon icon-menus"></span>
            <h4>我</h4>
        </router-link>
    </div>
</template>

<script>
export default {
    name: 'menuBarComponent'
};
</script>

<style scoped lang="less">
@import '../style/common.less';
.menu-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    padding: 0 20px;
    height: 100px;
    width: 710px;
    border-top: 2px solid #eee;
    background-color: @cfff;
    display: flex;
    justify-content: space-around;
    align-items: center;
    text-align: center;
    a {
        width: 20%;
        display: block;
        font-size: 24px;
        color: @c333;
        &:nth-of-type(1) .icon {
            background-position-x: 0px;
        }
        &:nth-of-type(4) .icon {
            background-position-x: -50px;
        }
        &:nth-of-type(2) .icon {
            background-position-x: -100px;
        }
        &:nth-of-type(3) .icon {
            background-position-x: -150px;
        }
        &.router-link-active,
        &.on {
            .icon {
                background-position-y: -50px;
            }
            h4 {
                color: @mainc;
            }
        }
    }
    .icon {
        width: 50px;
        height: 50px;
        display: block;
        margin: 0 auto;
        margin-bottom: 10px;
        &.icon-menus {
            background-image: url('../img/icon-menus.png');
            background-size: 200px 100px;
            background-position-y: 0;
            background-repeat: no-repeat;
        }
    }
}
</style>